import request from '@/utils/request'
function getType(data){
  let str = Object.prototype.toString.call(data).slice(8);
  return str.substr(0,str.length-1).toLowerCase() 
}
function getParams(data){
  if(data.categoryId&&data.categoryId.length>0){
    data.categoryId = data.categoryId[data.categoryId.length-1]
  }else{
    data.categoryId=''
  }
  if(data.dateRange&&data.dateRange.length>0){
    data.createTimeStrStart = data.dateRange[0]
    data.createTimeStrEnd = data.dateRange[1]
    data.createTimeStart = data.dateRange[0]
    data.createTimeEnd = data.dateRange[1]
  }else{
    data.createTimeStrStart = ''
    data.createTimeStrEnd = ''
    data.createTimeStart = ''
    data.createTimeEnd = ''
  }

  return data
}
//查询列表
export function getListDataPage(params,data) {
  data =getParams(data)
  return request({
    url:params.url,
    method:params.method || 'get',
    data:data,
    params:data
  })
}

